﻿function AutoFixAllHeight() {

    var txts = document.getElementsByTagName("textarea");
    for (var i = 0; i < txts.length; i++) {
        AutoFixHeight(txts[i]);
    }
}


function AutoFixHeight(obj) {
    if (!document.all) { obj.style.height = 'auto'; }
    var h = (obj.value == "") ? 40 : Math.max(obj.scrollHeight + 4, 20);
    if (obj.style.height != h) {
        obj.style.height = h + "px";
    }

}